﻿using System;
using System.Reflection;

namespace PageAdmin.Utils.ORM.PropertyDescriptor
{
    /// <summary>
    /// 子表数据描述器
    /// </summary>
    public class SubdataMappedDescriptor
    {
        /// <summary>
        /// 字表对应的类型
        /// </summary>
        public Type SubmodelType { get; set; }

        /// <summary>
        ///子表的主键属性元数据
        /// </summary>
        public PropertyInfo PrimaryKeyPropertyInfo{ get; set; }
        
        /// <summary>
        /// 子表的外键的属性元数据
        /// </summary>
        public PropertyInfo ForeignKeyPropertyInfo { get; set; }

        /// <summary>
        /// 子表的表名
        /// </summary>
        public string SubtableName { get; set; }


        /// <summary>
        /// 外键名称
        /// </summary>
        public string ForeignKey { get; set; }

        /// <summary>
        /// 添加数据时，是否自动同步子数据
        /// </summary>
        public bool SyncAdd { get; set; }

        /// <summary>
        /// 是否同步删除子数据
        /// </summary>
        public bool SyncDelete { get; set; }

        /// <summary>
        /// 编辑数据时，是否同步子数据
        /// </summary>
        public bool SyncEdit { get; set; }

        /// <summary>
        /// 详情数据是否同步加载
        /// </summary>
        public bool DetailSyncLoad { get; set; }

        /// <summary>
        /// 列表数据是否同步加载
        /// </summary>
        public bool ListSyncLoad { get; set; }

        /// <summary>
        /// 读取条件
        /// </summary>
        public string SqlCondition { get; set; }

        /// <summary>
        /// 排序方式
        /// </summary>
        public string OrderBy { get; set; }

    }
}